#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
    bool queryString(string s, int n) {
        if (n >= 2048) return false;
        vector<int> hash(n + 1);
        int len = 0, i, cur, j;
        i = n;
        while (i != 0) len++, i >>= 1;
        for (i = 0; i <= s.size(); i++) {
            if (s[i] == '0') continue;
            cur = 0;
            for (j = i; j < i + len && j < s.size(); j++) {
                cur <<= 1;
                cur += (s[j] == '1');
            }
            while (cur != 0) {
                if (cur <= n) hash[cur] = 1;
                cur >>= 1;
            }
        }
        for (i = 1; i <= n; i++)
            if (hash[i] == 0) return false;
        return true;
    }
};
int main()
{
	return 0;
}